<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Mixins 混入选项操作</title>
    <script src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>Mixins 混入选项操作</h1>
    <hr>
    <div id="app">
       <p>num:{{num}}</p>
       <p><button @click="add">增加</button></p>
    </div>
</body>
<script>
    //额外临时加入用于显示日志
    var addLog = {
        updated:function(){
            console.log("数据发生变化，变成了"+this.num)
        }
    }
    var app = new Vue({
        el:"#app",
        data:{ 
            num:10
        },
        methods: {
            add(){
                this.num++
            }
        },
        updated:function(){
            console.log("构造器里的updated方法。")
        },
        mixins: [addLog]
    })
</script>
</html>